<!DOCTYPE html>
<html>
<head>
	<title>登录</title>
	<link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
	<link rel="stylesheet" type="text/css" href="__CSS__/login/login.css">
	<script type="text/javascript" src="__JS__/jquery.js"></script>
	<style type="text/css">
		.login_b_box .inp_box .send{
			float: right;
			width: 28%;
			height: 34px;
			border:1px solid #fff;
			cursor: pointer;
			text-align: center;
			line-height: 34px;
			font-size: 13px;
			background:#222 ;
			color: white;
		}
		.login_b_box .inp_box .send2{
			background:#666;
			color: white;
			display: none;
		}
	</style>
</head>
<body>
	<div id="login_bg">
		<div class="login_b_box">
			<div class="login_box">
				<div class="title">
					<span>网站后台管理系统</span>
				</div>
				<div class="content">
					<div class="user_box inp_box">
						<label for="user">手机号:</label>
						<input type="text" name="user" id="user" placeholder="请输入用户名">
						<i class="user_img"></i>
						<p class="userMsg"></p>
					</div>
					
					<div class="pass_box inp_box">
						<label for="pass">验证码:</label>
						<input type="password" name="pass" id="pass" placeholder="请输入验证码" style="width: 45%;">
						<i class="pass_img" style="right: 32%;"></i>
						<div class="send" id="send">发送验证码</div>
						<div class="send send2"><span id="secend">60</span>S后重新发送</div>
						<p class="pwdMsg"></p>
					</div>
					
					<div class="btn_box">
						<button id="login_btn">登录</button>
					</div>
				</div>
				<div style="width:100%;height:1px;"></div>
			</div>
			<div class="login_inv"></div>
		</div>
	</div>
	<script type="text/javascript">
		var num=60;
		$("#login_btn").click(function(){
			var tel = $("#user").val();
			var pwd = $("#pass").val();
			if(!tel){
				$(".pwdMsg").html("请输入手机号~");
				return;
			}else if(!pwd){
				$(".pwdMsg").html("请输入验证码~");
				return;
			}
			$.post("{{:url('manage/Login/Login')}}",{tel:tel,pwd:pwd},function(data){
				var data = JSON.parse(data);
				console.log(data);
				if(data.status){
					window.location.href="{{:url('manage/User/index')}}";
				}else{
					$(".pwdMsg").html(data.message);
				}
			})
		})
		$("#send").click(function(){
			var tel=$("#user").val();
			if(!tel){
				$(".pwdMsg").html("请输入手机号~");
				return;
			}
			$.post("{{:url('manage/Login/sendCode')}}",{tel:tel},function(data){
				var data=JSON.parse(data);
				if(data.status){
					$("#send").hide();
					$(".send2").show();
					var timer1=setInterval(function(){
						num--;
						$("#secend").text(num);
					},1000);
					setTimeout(function(){
						$(".send2").hide();
						$("#send").show();
						clearInterval(timer1);
						num=60;
					},60000);

					$(".pwdMsg").html("");
				}else{
					$(".pwdMsg").html(data.message);
				}
			})
		})
	</script>
</body>
</html>